<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@ page import="net.sf.ehcache.*"%>
<jsp:useBean id="cache" type="net.sf.ehcache.Cache" scope="application"/>

<form>
<h3>Cache Region: <%=cache.getName()%></h3>
<table>
	<tr>
		<th>Key<th>
		<td><input type='text' name='key'/></td>
	</tr>
	<tr>
		<th>Value<th>
		<td><input type='text' name='value'/></td>
	</tr>
	<tr>
		<td colspan='2'>
			<input type='submit' value='Write Cache'/>
		</td>
	</tr>
</table>
</form>
<%
	String key = request.getParameter("key");
	String value = request.getParameter("value");
	if(key!=null&&key.length()>0){
		Element obj = new Element(key,value);
		cache.remove(key);
		cache.put(obj);
		out.print("Cache wrote："+key+"="+value);
	}
%>
<p><a href="index.jsp">Back to Index</a></p>
